#ifndef ODN_MODELENTITY_H
#define ODN_MODELENTITY_H

#include <opal\opal.h>
#include <ogre\Ogre.h>

#include "ODN_ModelBit.h"
#include "ODN_BaseEntity.h"
#include "ODN_Maths.h"
#include "ODN_Containers.h"

namespace ouden {

class CModelEntity : public CBaseEntity
{
	public:

        DECLARE_ENTITY_CLASS(CModelEntity);

        //REMOVE CModelEntity(); // TEST
        CModelEntity(String sName);
		CModelEntity(String sName, String sModelName);
		virtual ~CModelEntity();

		virtual void update();

		//REMOVE void addBit(CModelBit* bit) 		{ m_pBits.push_back(bit); }

		void changeAnimState(String newState) { m_pCurrentAnimState = m_pOgreEntity->getAnimationState(newState); }

		// TODO: think how do these work with jetpacking?
		enum SimulationState { ANIMATING, BLENDING, RAGDOLLING };
		void changeSimState(SimulationState newState);

        //CRAP probably
        opal::Solid* getSolid(int num) { return m_pRootBit->getChild(num)->getSolid(); }


	protected:

        //REMOVE Array<CModelBit*> m_pBits

		CModelBit* m_pRootBit;
		Ogre::Entity* m_pOgreEntity;
		Ogre::AnimationState* m_pCurrentAnimState;

		SimulationState simState;

	private:

};

} //namespace ouden

#endif // ODN_MODELENTITY_H
